package org.dark.fund.exceptions;

import lombok.Getter;
import org.dark.fund.enums.ResultCode;

@Getter
public abstract class FundException extends RuntimeException{

    protected String code;

    protected String msg;

    public FundException() {
    }

    public FundException(String message) {
        super(message);
    }

    public FundException(String message, Throwable cause) {
        super(message, cause);
    }

    public FundException(Throwable cause) {
        super(cause);
    }

    public FundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public FundException(ResultCode resultCode) {
        super(resultCode.getCode() + ": " + resultCode.getMsg());
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
    }

    public FundException(ResultCode resultCode, Throwable cause) {
        super(resultCode.getCode() + ": " + resultCode.getMsg(), cause);
    }
}
